﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
using TreeView = System.Windows.Forms.TreeView;
using TreeNodeCollection = System.Windows.Forms.TreeNodeCollection;
using AMS.DeDuplicator.CommonLayer.Iterator;

namespace AMS.DeDuplicator.CommonLayer.Adapter
{
    public class TreeViewAdapter : ITree
    {
        TreeView _treeView;

        public TreeNodeCollection Nodes { get { return _treeView.Nodes; } }

        public TreeViewAdapter(TreeView treeView)
        {
            InputValidator.ValidateNotNull(treeView);

            _treeView = treeView;
        }

        public IIterator<ISelectableText> GetRootIterator()
        {
            return new TreeIterator(new TreeViewAdapter(_treeView), TreeIterator.NodeIterationOption.RootNodes);
        }

        public IIterator<ISelectableText> GetFullIterator()
        {
            return new TreeIterator(new TreeViewAdapter(_treeView), TreeIterator.NodeIterationOption.AllNodes);
        }

        public IIterator<ISelectableText> GetNonRootIterator()
        {
            return new TreeIterator(new TreeViewAdapter(_treeView), TreeIterator.NodeIterationOption.NonRootNodes);
        }

        public IIterator<ISelectableText> CreateIterator()
        {
            return GetFullIterator();
        }
    }
}
